/**********************************************************************************************************************
 *  -------------------------------------------------------------------------------------------------------------------
 *  file description
 *  -------------------------------------------------------------------------------------------------------------------
 *         \file  vkern.h
 *         \unit  vkern
 *        \brief  module declaration header file
 *      \details  v1.0.0
 *********************************************************************************************************************/
#ifndef __vkern_H
#define __vkern_H

#include "vk_type.h"
#include "vk_config.h"
#include "export.h"

/* function declaration */
ke_ret_t vkern_init(vkern_tick_t tick_func, uint16_t time_slice);
ke_ret_t vtask_create(vtask_t task, uint8_t prio, vtask_state_t state, uint16_t period, task_handler_t handler);
vtask_t vtask_create_dynamic(uint8_t prio, vtask_state_t state, uint16_t period, task_handler_t handler);
ke_ret_t vtask_delete(vtask_t task);
ke_ret_t vtask_attach(vtcb_t tcb);
ke_ret_t vtask_dettach(vtcb_t tcb);
ke_ret_t vtask_suspend(vtask_t task);
ke_ret_t vtask_resume(vtask_t task);
uint32_t vtask_num(void);
vtask_t vtask_runnning(void);
void vtask_schedule(void);
void vtask_list(uint8_t list);

/* kernel debugging macro definition */
#ifdef KERN_USING_ERROR 
ke_ret_t _error(ke_ret_t e, char* file, int line);
#define K_ERROR(e)	(_error(e, __FILE__, __LINE__))
#else
#define K_ERROR(e)	(##e)
#endif

#endif

